package com.fishery.order.mapper;

import com.fishery.order.entity.Customer;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fishery.order.entity.vo.CustomerRankVo;
import com.fishery.order.entity.vo.CustomerVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author run 、ghost
 * @since 2021-01-31
 */
public interface CustomerMapper extends BaseMapper<Customer> {

	/**
	 * 通过基地ID查询基地的所有顾客信息
	 *
	 * @param baseId
	 * @return
	 */
	List<CustomerVo> findCustomerVos(String baseId);

	/**
	 * 通过基地ID分页查询基地的顾客信息
	 *
	 * @param baseId
	 * @param offset
	 * @param size
	 * @return
	 */
	List<CustomerVo> selectCustomerVosWithPage(@Param("baseId") String baseId,
											   @Param("offset") int offset,
											   @Param("size") int size);

	/**
	 * 修改顾客信息
	 *
	 * @param customerVo
	 * @return
	 */
	int updateById(CustomerVo customerVo);

	/**
	 * 通过基地ID查询基地的前Size的大客户
	 *
	 * @param baseId
	 * @param size
	 * @return
	 */
	List<CustomerRankVo> findTopCustomerOfBase(@Param("baseId") String baseId, @Param("size") Integer size);
}
